#if !defined(AFX_SUBSQTDIAGPAGE_H__85FBD9BF_8027_440B_A122_7485A2CC7E78__INCLUDED_)
#define AFX_SUBSQTDIAGPAGE_H__85FBD9BF_8027_440B_A122_7485A2CC7E78__INCLUDED_

#include "PageDialog.h"
#include "../Common/TabCtrlEx.h"

#include "BCDoctorWritePage.h"
#include "BCBergScorePage.h"
#include "BCFuglMeyerUpPage.h"
#include "BCFuglMeyerLowPage.h"
#include "BCHoldenWalkPage.h"
#include "BCFuglMeyerBalPage.h"
#include "BCReviseAshworthPage.h"
#include "BCBrunnstromPage.h"
#include "BCTinettiBalPage.h"
#include "BCMiniMentalPage.h"
#include "../Gait/GaitAnaly.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SubsqtDiagPage.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CSubsqtDiagPage dialog

class CSubsqtDiagPage : public CPageDialog
{
// Construction
public:
	CSubsqtDiagPage(CWnd* pParent = NULL);   // standard constructor
	~CSubsqtDiagPage();

	virtual BOOL	Prepare();
	virtual BOOL	ClearUp();

	virtual BOOL	SaveData(CString strMRN);
	virtual BOOL	ShowTableData(CString strMRN);
	virtual BOOL	ClearData();
	virtual BOOL	EnableInputControls(BOOL bEnable);

	BOOL			ShowTableDataByDiagSN(CString strMRN, int nDiagSN, BOOL* pbIsDraft);
	BOOL			NewSdiag(int nNewDiagSN);
	void			SetDiagSN(int nDiagSN){m_nDiagSN = nDiagSN;}
	void			SetRealtimeState();


// Dialog Data
	//{{AFX_DATA(CSubsqtDiagPage)
	enum { IDD = IDD_DIALOG_PAGE_SUBSQDIAG };
	CSpinButtonCtrl	m_spinSdiagOpen;
	CSpinButtonCtrl	m_spinSdiagClose;
	CTabCtrlEx	m_tabSdiagBC;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSubsqtDiagPage)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CSubsqtDiagPage)
	virtual BOOL OnInitDialog();
	afx_msg void OnSelchangeTabBcSdiag(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnButtonSdiagDraftsave();
	afx_msg void OnButtonSdiagSave();
	afx_msg void OnButtonSnap();
	afx_msg void OnButtonSdiagContinue();
	afx_msg void OnDeltaposSpinSdiagClose(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDeltaposSpinSdiagOpen(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnChangeEditSdiagSticlose();
	afx_msg void OnChangeEditSdiagStiopen();
	//}}AFX_MSG
	afx_msg void OnRefreshOpenClose(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()

private:
	BOOL						ShowParamsFromWA();
	BOOL						ShowMedInfoByDiagSN(CString strMRN, int nDiagSN, BOOL* pbIsDraft);

	BOOL						SaveMedInfo(CString strMRN, BOOL bIsDraft);
	BOOL						SaveBodyCheck(CString strMRN, BOOL bIsDraft);
	BOOL						WriteWAParams(CString strMRN);
	BOOL						ReadWABasicParam();

	BOOL						ShowRealTimeGait();
	BOOL						ShowStaticGaitSnap();
	BOOL						IsAllBodyCheckBlank();

	BOOL						DrawPausedStaticGait();

	BOOL						StopRealTimeGait();
	static void		CALLBACK	ShowGaitTimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime);

private:
	CBCDoctorWritePage			m_pageDoctorWrite;
	CBCBergScorePage			m_pageBergScore;
	CBCFuglMeyerUpPage			m_pageFuglMeyerUp;
	CBCFuglMeyerLowPage			m_pageFuglMeyerLow;
	CBCHoldenWalkPage			m_pageHoldenWalk;
	CBCFuglMeyerBalPage			m_pageFuglMeyerBal;
	CBCReviseAshworthPage		m_pageReviseAshworth;
	CBCBrunnstromPage			m_pageBrunnstrom;
	CBCMiniMentalPage			m_pageMiniMental;
	CBCTinettiBalPage			m_pageTinettiBal;
	
	BOOL						m_bDraftSave;
	int							m_nDiagSN;

	CGaitAnaly*					m_pGaitDraw;
	WA_BASIC_PARA				m_BasicPara;

	DWORD				m_adwGaitSnap[GAIT_POINT_ARRAY_SIZE];
	int					m_nStartPos;
	DWORD				m_dwStiOpen;
	DWORD				m_dwStiClose;

	BOOL				m_bTextChangeFromGait;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SUBSQTDIAGPAGE_H__85FBD9BF_8027_440B_A122_7485A2CC7E78__INCLUDED_)
